#pragma once
#include <netinet/in.h>
#include<string>



class InetAddress
{

public:
    InetAddress(uint16_t port, std::string ip = "127.0.0.1");
    explicit InetAddress(sockaddr_in addr): addr_(addr){};
    InetAddress(){};



    std::string toIp() const;
    std::string toIpPort()const;
    uint16_t toPort() const;
    const sockaddr_in* getSockAddr() const {return &addr_;}
 
    void setSockAddr(sockaddr_in addr){addr_ = addr;}
    
private:
    sockaddr_in addr_;
};
